/*
 * @Author: 过峰 2452342725@qq.com
 * @Date: 2022-07-03 09:57:06
 * @LastEditors: 过峰 2452342725@qq.com
 * @LastEditTime: 2022-09-21 09:29:25
 * @FilePath: \desert-star\src\pages\ComParams\index.tsx
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
/**
 * @description 组合参数配置
 * @author gf
 */
import { useState } from "react";
import { Title } from "@/components/Title";
import { PageWrapper } from "@/components/PageWrapper";
import styled from "styled-components";
import TreeParams from "@/components/Trees/TreeParams";
import PageRight from "@/components/FOF/PageRight";
import { getUrlParam } from "@/utils/utils";

const OverContent = styled.div`
  display: flex;
  width: 100%;
  margin-top: 12px;
  height: calc(100vh - 56px);
`;

const ComParams = () => {
  const portfolioCode = getUrlParam("portfolioCode");
  const [values, setValues] = useState({} as any);

  const [nodeInfo, setNodeInfo] = useState({});

  const handleReceiveParmas = (params: any) => {
    console.log(params);
    setValues(params);
    // setNodeInfo({})
  };
  // 重新查询树
  const handleQueryTree = (info: any) => {
    console.log(info, values);
    setNodeInfo(info);
  };
  return (
    <PageWrapper minWidth="900px" style={{ overflowY: "hidden" }}>
      <Title>跟踪参数配置</Title>
      <OverContent>
        <TreeParams
          onClick={handleReceiveParmas}
          fundCode="1"
          paramsType="com"
          portfolioCodeProp={portfolioCode}
          nodeInfo={nodeInfo}
        />
        <PageRight handleQueryTree={handleQueryTree} values={values} />
      </OverContent>
    </PageWrapper>
  );
};

export default ComParams;
